Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Test Coverage for Speculation Rules Plugin #1845

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

sarthak-19
Copy link
Contributor

@sarthak-19 sarthak-19 commented Feb 4, 2025

Summary

This is part of #1789:

  • Ignore Coverage for Non-Critical Code Blocks
  • Add Missing @covers Annotations
  • Add Missing Tests
Before : 50.00% ⚠️ After: 92.00% ✅
image  image

cc : @westonruter

@sarthak-19 sarthak-19 changed the title Add missing test case for improving code coverage Improve Test Coverage for Speculation Rules Plugin Feb 4, 2025
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.31%. Comparing base (d21b74d) to head (66b31f2).
Report is 12 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1845      +/-   ##
==========================================
+ Coverage   66.64%   68.31%   +1.67%     
==========================================
  Files          88       87       -1     
  Lines        7015     6982      -33     
==========================================
+ Hits         4675     4770      +95     
+ Misses       2340     2212     -128     
Flag Coverage Δ
multisite 68.31% <ø> (+1.67%) ⬆️
single 39.18% <ø> (+1.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@westonruter westonruter added this to the speculation-rules n.e.x.t milestone Feb 5, 2025
@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature [Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) skip changelog PRs that should not be mentioned in changelogs labels Feb 5, 2025
@sarthak-19 sarthak-19 marked this pull request as ready for review February 5, 2025 13:44
Copy link

github-actions bot commented Feb 5, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @[email protected].

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: [email protected].

Co-authored-by: sarthak-19 <[email protected]>
Co-authored-by: westonruter <[email protected]>
Co-authored-by: felixarntz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter
Copy link
Member

In uninstall.php:

// If uninstall.php is not called by WordPress, bail.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}

Can be updated to follow Optimization Detective to add the // @codeCoverageIgnore comment:

// If uninstall.php is not called by WordPress, bail.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit; // @codeCoverageIgnore
}

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although the issue with @covers is still mystifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Speculative Loading Issues for the Speculative Loading plugin (formerly Speculation Rules) skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants